#include<stdio.h>

int main()
{
	pid_t pid = getpid();
	pid_t id = fork();
	if(id == 1)
	{
		printf("fork error ! return code is:%d\n",errno);
		return 2;
	}
	else if(id == 0)
	{
		printf("child pid is %d\n",getpid());
		exit(3);
	}
	else
	{
		while(1){
			printf("father pid is %d,return pid is %d\n",getpid(),id);
			sleep(1);
		}
	}
	return 0;
}
